home *** CD-ROM | disk | FTP | other *** search
Text File | 1989-11-06 | 1.2 KB | 54 lines | [TEXT/QED1] |
- /*
- Terminal 1.7
- "Log into ComNet.s"
- */
-
- /* ----- Send command and wait for reply ------------------------------- */
-
- check(char *command, char *reply)
- {
- type(command);
- return prompt(reply, 1800); /* Timeout = 30 sec */
- }
-
- /* ----- Wait for prompt and send command ------------------------------ */
-
- answer(char *hint, char *command)
- {
- int result;
-
- if (result = prompt(hint, 1800))
- return result; /* Timeout or cancel */
- pause(30); /* Don't type immediatly */
- type(command);
- return 0;
- }
-
- /* ----- main program -------------------------------------------------- */
-
- main()
- {
- int go = 1;
-
- while (go) {
- if (check("ATDP22534\r", "CONNECT")) /* Dial */
- break;
- if (answer("Return", "\r")) /* Wait for "Hit Return" */
- break;
- if (answer("<RETURN>", "\r")) /* Select Graphics Style */
- break;
- if (answer("User", "2001604\r")) /* Enter ID Number */
- break;
- if (answer("Password", "...\r")) /* Enter password */
- break;
- go = 0; /* Ok */
- }
- if (go) { /* Timeout or cancel */
- setdtr(0); /* Negate DTR: modem hangs up */
- pause(60); /* Wait one second */
- setdtr(1); /* Assert DTR: now back in command mode */
- beep(); /* 2 beeps if error */
- }
- beep();
- }
-